﻿using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using akibank.Dossier.DossierExchangeDocument;

namespace akibank.Dossier.Client
{
  partial class DossierExchangeDocumentActions
  {
    public override void ChangeDocumentType(Sungero.Domain.Client.ExecuteActionArgs e)
    {
      //base.ChangeDocumentType(e);
      var types = new List<Sungero.Domain.Shared.IEntityInfo>() {DossierCommonDocuments.Info};
      var convertedDocument = Sungero.Docflow.PublicFunctions.OfficialDocument.ChangeDocumentType(_obj, types);
      if (convertedDocument != null)
      {
        // Dmitriev_IA: Критически важно для корректного открытия в десктоп клиенте карточки сконвертированного документа.
        e.CloseFormAfterAction = true;
        convertedDocument.Show();
      }
    }

    public override bool CanChangeDocumentType(Sungero.Domain.Client.CanExecuteActionArgs e)
    {
      //return base.CanChangeDocumentType(e);
      return true;
    }

  }

}